package com.todod.base.module.base.dal.mysql.device;

import java.util.*;

import com.todod.base.framework.common.pojo.PageResult;
import com.todod.base.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.todod.base.framework.mybatis.core.mapper.BaseMapperX;
import com.todod.base.module.base.dal.dataobject.device.DeviceDO;
import org.apache.ibatis.annotations.Mapper;
import com.todod.base.module.base.controller.admin.device.vo.*;

/**
 * 仪器设备 Mapper
 *
 * @author 平台
 */
@Mapper
public interface DeviceMapper extends BaseMapperX<DeviceDO> {

    default PageResult<DeviceDO> selectPage(DevicePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DeviceDO>()
                .eqIfPresent(DeviceDO::getCode, reqVO.getCode())
                .likeIfPresent(DeviceDO::getName, reqVO.getName())
                .eqIfPresent(DeviceDO::getType, reqVO.getType())
                .eqIfPresent(DeviceDO::getMode, reqVO.getMode())
                .eqIfPresent(DeviceDO::getOtherParams, reqVO.getOtherParams())
                .eqIfPresent(DeviceDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(DeviceDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DeviceDO::getId));
    }

}